from src.handlers.mongo_handler import MongoDBHandler
from src.handlers.qdrant_handler import QdrantHandler
from src.config import DB_CONFIG, Qdrant_CONFIG

EMBEDDING_MODEL = "BAAI/bge-m3"
# EMBEDDING_MODEL = "/mnt/hf_models/huggingface/hub/models--BAAI--bge-m3"

# 初始化
mongo_handler = MongoDBHandler(DB_CONFIG['url'])
qdrant_handler = QdrantHandler(Qdrant_CONFIG['url'], Qdrant_CONFIG['collection_name'], EMBEDDING_MODEL)

def main():
    results = mongo_handler.search_documents(DB_CONFIG["db_name"], DB_CONFIG["collection_name"])

    qdrant_handler.insert_documents(results)
    search_results = qdrant_handler.search("明星娱乐", top_k=5)
    for i, item in enumerate(search_results, 1):
        print(f"\n第 {i} 条结果：")
        print("feed_content:", item['feed_content'])
        print("feed_url:", item['feed_url'])
    print("Search Results:", search_results) 

if __name__ == "__main__":
    main()
    
    
